<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<iframe></iframe>
<script>
description('Should not crash if iframe\'s document element\'s focusout event handler removes the iframe in the parent document.');

window.jsTestIsAsync = true;

function run()
{
    var iframe = document.getElementsByTagName('iframe')[0];
    iframe.contentDocument.documentElement.contentEditable = true;
    iframe.contentDocument.documentElement.addEventListener('focusout', function () {
        iframe.parentNode.removeChild(iframe);
    }, false);
    iframe.contentDocument.documentElement.focus();

    testPassed('Did not crash.');
    window.finishJSTest();
}

document.addEventListener('DOMContentLoaded', run);
</script>
</body>
</html>
